package mapper.Impl;

import mapper.adminMapper;
import pojo.admin;
import utils.DBUtils;

import java.sql.SQLException;

public class adminMapperImpl implements adminMapper {

    @Override
    public admin getAdmin(String username,String password) throws SQLException {
        return DBUtils.commonQueryObj(admin.class, "select * from admin where username=? and password=?", username, password);
    }

    @Override
    public admin getAdmin(String username) throws SQLException {
        return DBUtils.commonQueryObj(admin.class, "select * from admin where username=?", username);
    }

    @Override
    public void updatePassword(String username, String newCode) throws SQLException {
        DBUtils.commonUpdate("update admin set password=? where username=?", newCode, username);
    }
}
